<?php
require_once 'User.php';

class AdminHandler
{
	private $m_database = NULL;
	private $m_tablePrefix = NULL;

    public function __construct(DatabaseConnection $database)
    {
        $this->m_database = $database;
		$this->m_tablePrefix = $database->getTablePrefix();
    }
	
	public function getAllUsers()
	{
        $UserArray = array();
        
        $sqlStatement = "SELECT uid, username FROM ".$this->m_tablePrefix."users ORDER BY uid ASC";

        $stmt = $this->m_database->PrepareStatement($sqlStatement);

        $stmt->execute();

        $stmt->bind_result($uid, $username);

        while ($stmt->fetch())
        {
			$user = new user($uid, $username);
            $UserArray[] = $user;
        }

        $stmt->close();

        return $UserArray;
	}
}